package com.mapull.primitive;

import java.util.Enumeration;
import java.util.Properties;

/**
 * @author Mapull
 * @date 2024-03-23
 */
public class SimpleInteger {

    public static void main(String[] args) {
        int i1 = new Integer("21");
        String str1 = Integer.toString(i1);
        String str2 = Integer.toString(21);
        System.out.println(str1);
        System.out.println(str1.equals(str2));
    }

    public static void main321(String[] args) {
        String str = Integer.toString(3, 2);
        System.out.println(str);
        String str2 = Integer.toString(-3, 2);
        System.out.println(str2);
        String str3 = Integer.toString(10, 8);
        System.out.println(str3);
        String str4 = Integer.toString(10, 16);
        System.out.println(str4);
        String str5 = Integer.toString(100, 22);
        System.out.println(str5);
    }
    public static void main32(String[] args) {
        Integer i1 = new Integer("36");
        System.out.println(i1.toString());
        Integer i2 = new Integer("-12");
        System.out.println(i2.toString());
    }
    public static void main65(String[] args) {
        String str1 = Integer.toOctalString(10);
        System.out.println(str1);
        String str2 = Integer.toOctalString(-10);
        System.out.println(str2);
        String str3 = Integer.toOctalString(6);
        System.out.println(str3);
        String str4 = Integer.toOctalString(0);
        System.out.println(str4);
    }
    public static void main378(String[] args) {
        String str1 = Integer.toHexString(10);
        System.out.println(str1);
        String str2 = Integer.toHexString(-10);
        System.out.println(str2);
        String str3 = Integer.toHexString(6);
        System.out.println(str3);
        String str4 = Integer.toHexString(0);
        System.out.println(str4);
    }

    public static void main333(String[] args) {
        String str = Integer.toBinaryString(6);
        System.out.println(str);
        String s2 = Integer.toBinaryString(-6);
        System.out.println(s2);
        String s3 = Integer.toBinaryString(0);
        System.out.println(s3);
    }
    public static void main789(String[] args) {
        Integer i1 = Integer.valueOf(312);
        Integer i2 = Integer.valueOf("312");
        System.out.println(i1.equals(i2));
        System.out.println(i1 == i2);
    }

    public static void main56(String[] args) {
        Integer i1 = Integer.valueOf(12);
        Integer i2 = Integer.valueOf("12");
        System.out.println(i1.equals(i2));
        System.out.println(i1 == i2);
    }

    public static void main567(String[] args) {
        Integer i1 = Integer.valueOf("100", 2);
        System.out.println(i1);
        Integer i2 = Integer.valueOf("100", 8);
        System.out.println(i2);
        Integer i3 = Integer.valueOf("100", 10);
        System.out.println(i3);
        Integer i4 = Integer.valueOf("100", 16);
        System.out.println(i4);
    }

    public static void main89(String[] args) {
        Integer i1 = Integer.getInteger("sun.arch.data.model", 16);
        System.out.println(i1);
        Integer i2 = Integer.getInteger("test.xyz", 123);
        System.out.println(i2);
        Integer i3 = Integer.getInteger("file.encoding", 18);
        System.out.println(i3);
    }

    public static void main67(String[] args) {
        String property = System.getProperty("file.encoding");
        System.out.println(property);
        Integer i1 = Integer.getInteger("file.encoding");
        System.out.println(i1);
        Integer i2 = Integer.getInteger("test.xyz");
        System.out.println(i2);
    }
    public static void getProperties() {
        Properties properties = System.getProperties();
        Enumeration<?> enumeration = properties.propertyNames();
        while (enumeration.hasMoreElements()){
            String key = enumeration.nextElement().toString();
            String property = System.getProperty(key);
            System.out.println("key " + key + " :  " + property);

        }
    }
    public static void main456(String[] args) {
        Integer i1 = Integer.getInteger("sun.arch.data.model");
        System.out.println(i1);
        System.setProperty("config.num", "99");
        Integer i2 = Integer.getInteger("config.num");
        System.out.println(i2);
    }

    public static void main345(String[] args) {
        Integer i1 = new Integer(987);
        Integer i2 = new Integer("1234567890");
        short s1 = i1.shortValue();
        short s2 = i2.shortValue();
        System.out.println(s1);
        System.out.println(s2);
    }

    public static void main14(String[] args) {
        int i1 = Integer.parseInt("12", 10);
        System.out.println("十进制表示 " + i1);
        int i2 = Integer.parseInt("1F", 16);
        System.out.println("十六进制表示 " + i2);
        int i3 = Integer.parseInt("12", 8);
        System.out.println("八进制表示 " + i3);
        int i4 = Integer.parseInt("101", 2);
        System.out.println("二进制表示 " + i4);
    }
    public static void main13(String[] args) {
        int i1 = Integer.parseInt("123");
        System.out.println(i1);
        int i2 = Integer.parseInt("-6");
        System.out.println(i2);
        int i3 = Integer.parseInt("123456789");
        System.out.println(i3);
        int i4 = Integer.parseInt("+9");
        System.out.println(i4);
    }

    public static void main12(String[] args) {
        int i1 = Integer.parseInt("123");
        System.out.println(i1);
        int i2 = Integer.parseInt("123456789");
        System.out.println(i2);
    }
    public static void main23(String[] args) {
        int i2 = Integer.parseInt("1234567890876");
        System.out.println(i2);
        int i3 = Integer.parseInt("1MB");
        System.out.println(i3);
    }
    public static void main88(String[] args) {
        Integer i1 = new Integer("10086");
        Integer i2 = Integer.MAX_VALUE;
        long l1 = i1.longValue();
        long l2 = i2.longValue();
        System.out.println(l1);
        System.out.println(l2);
    }
    public static void main99(String[] args) {
        Integer i1 = new Integer("123");
        Integer i2 = Integer.MIN_VALUE;
        float f1 = i1.floatValue();
        float f2 = i2.floatValue();
        System.out.println(f1);
        System.out.println(f2);
    }
    public static void main8(String[] args) {
        Integer i1 = new Integer("23");
        Integer i2 = Integer.MAX_VALUE;
        double d1 = i1.doubleValue();
        double d2 = i2.doubleValue();
        System.out.println(d1);
        System.out.println(d2);
    }

    public static void main7(String[] args) {
        Integer i1 = new Integer("15");
        Integer i2 = new Integer(15);
        Integer i3 = new Integer(23);
        System.out.println(i1.equals(i2));
        System.out.println(i1 == i3);
        System.out.println(i1.equals(i3));
    }

    public static void main6(String[] args) {
        System.out.println(Integer.decode("123"));
        System.out.println(Integer.decode("007"));
        System.out.println(Integer.decode("8G"));
    }

    public static void main5(String[] args) {
        Integer i1 = new Integer("12");
        Integer i2 = new Integer(12);
        Integer i3 = new Integer(33);
        Integer i4 = new Integer(4);
        System.out.println(i1.compareTo(i2));
        System.out.println(i1.compareTo(i3));
        System.out.println(i1.compareTo(i4));
        System.out.println(i2.compareTo(i3));
    }
    public static void main4(String[] args) {
        System.out.println(new Integer(2).byteValue());
        System.out.println(new Integer("127").byteValue());
        System.out.println(new Integer("666").byteValue());
    }
    public static void main3(String[] args) {
        System.out.println(Integer.MAX_VALUE);
        System.out.println(Integer.MIN_VALUE);
        System.out.println(Integer.SIZE);
        System.out.println(Integer.TYPE);
        System.out.println(Integer.BYTES);
    }
    public static void main2(String[] args) {
        Integer i1 = new Integer("12");
        Integer i2 = new Integer(12);
        System.out.println(i1.equals(i2));
//        System.out.println(i1 == i2);
    }
}
